package com.accp.hotevent.resp;

import lombok.Data;

@Data
public class CommonResp<T> {

    private boolean success;

    private String message;

    private T data;

    // Static methods for quick responses
    public static  CommonResp success() {
        CommonResp resp = new CommonResp<>();
        resp.setSuccess(true);
        return resp;
    }


    public static <T> CommonResp<T> success(T data) {
        CommonResp<T> resp = new CommonResp<>();
        resp.setSuccess(true);
        resp.setMessage("Operation successful");
        resp.setData(data);
        return resp;
    }

    public static <T> CommonResp<T> success(T data, String message) {
        CommonResp<T> resp = new CommonResp<>();
        resp.setSuccess(true);
        resp.setMessage(message);
        resp.setData(data);
        return resp;
    }

    public static <T> CommonResp<T> failure(String message) {
        CommonResp<T> resp = new CommonResp<>();
        resp.setSuccess(false);
        resp.setMessage(message);
        return resp;
    }
}
